import { useModel } from 'umi';

export default function () {

  const { initialState, setInitialState } = useModel('@@initialState');

  function onClick () {
    const newState = { ...initialState };
    newState.modules.myPage.count++;
    setInitialState(newState);
  }

  return (
    <>
      { initialState?.modules.myPage.count }
      <button onClick={ onClick }>+1</button>
    </>
  );
}
